home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / woop.com / WINDOW.D < prev    next >
Encoding:
Text File  |  1990-04-07  |  3.3 KB  |  137 lines

  1. /*    \better-c\window.d
  2.  
  3.     Version:    0.00
  4.     Author:     kat
  5.     Create:     11/10/89
  6.     Update:     11/10/89
  7.  
  8.  
  9.     Window management OOP style
  10.  
  11. */
  12.  
  13.  
  14. /*    Defines and enums  */
  15.  
  16. #define Object_max    20
  17. #define Factor        2 /* 1 for text, 1 for attrib */
  18.  
  19. #define Window    wdw->p[handle]->
  20.  
  21. #define Direct_video_default    true /* true: direct memory mapping; false: bios */
  22.  
  23. /* Bios: interrupts and defines */
  24.  
  25. #define Bios_video        0x10
  26. #define Bios_keyboard        0x16
  27. #define Bios_multipurpose       0x21
  28. #define Bios_char_write        0x09
  29. #define Bios_char_read        0x08
  30. #define Bios_cursor_position    0x02
  31. #define Bios_cursor_size    0x01
  32. #define Bios_scroll_window_up    0x06
  33. #define Bios_mono_address    0xB000
  34. #define Bios_color_address    0xB800
  35. #define Bios_video_mono_test    (*(char far *) 0x00400049L == 7)
  36. #define Bios_read_keyboard_char     0x07
  37. #define Bios_test_keyboard_status    0x01
  38. #define Bios_cursor_off            0x20
  39. #define Bios_cursor_top_color        6
  40. #define Bios_cursor_bottom_color    7
  41.  
  42. #define Bios_cursor_top_mono        0x0B
  43. #define Bios_cursor_bottom_mono        0x0C
  44.  
  45. #define Screen_width        79    /* 0 - 79 */
  46. #define Screen_height        24    /* 0 - 24 */
  47. #define Default_attribute    7
  48.  
  49. #define Zero_flag        0x40
  50.  
  51. #define Extended_base        128 /* used for mapping above the ASCII set */
  52.  
  53.  
  54. #define S_vert_line    179    /* single line */
  55. #define S_hor_line    196
  56. #define S_ur        191     /* upper right corner */
  57. #define S_lr        217     /* lower right */
  58. #define S_ll        192     /* lower left  */
  59. #define S_ul        218     /* upper left  */
  60.  
  61. #define D_vert_line    186    /* double line */
  62. #define D_hor_line    205
  63. #define D_ur        187
  64. #define D_lr        188
  65. #define D_ll        200
  66. #define D_ul        201
  67.  
  68. #define Input_no_echo    -2
  69. #define Input_echo    -1
  70.  
  71. /* row/col coordinate map macro into memory area for text and attibute */
  72. #define Offset        ( Factor * (row * (Window cols) + col))
  73. #define Line_size    ( Factor * (Window cols))
  74. #define Scroll_adjust   2
  75.  
  76. /*  coordinate map macro into video memory area for text and attibute */
  77. #define Video_offset    ( Factor * ((row + Window disp_row) * 80 + Window disp_col))
  78. #define Cursor_offset    ( Factor * (row * 80 + col))
  79.  
  80. /* make far pointer: used for direct video mapping */
  81.  
  82. #define Make_far_pointer(seg, ofs)    ((void far *) \
  83.             ((( unsigned long )(seg) << 16) | (unsigned)( ofs )))
  84. #define Far_offset(fp)    ((unsigned)(fp))
  85. #define Far_segment(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  86.  
  87. #define Printable(c)    ((c) >= 0x20 && (c) <= 0x7e)
  88.  
  89.  
  90. enum border_style_    {
  91.                 No_border,
  92.             Solid_border,
  93.             Single_border,
  94.             Double_border
  95.             };
  96.  
  97. enum color_attribute_    {
  98.                          Black,
  99.              Blue,
  100.              Green,
  101.              Cyan,
  102.              Red,
  103.                          Magenta,
  104.              Brown,
  105.              White,
  106.              Gray,           /* high intensity */
  107.              Hi_blue,
  108.              Hi_green,
  109.              Hi_cyan,
  110.              Hi_red,
  111.              Hi_magenta,
  112.              Yellow,
  113.              Hi_white
  114.              };
  115.  
  116. enum read_write_option_    {
  117.             Display_window,
  118.             Save_window_area,
  119.             Restore_window_area
  120.             };
  121.  
  122.  
  123.  
  124. /* bios attribute macro in NL */
  125. #define On        + 16 * /* Usage example: Blue On Red */
  126.  
  127. /* Pop-up prompt and  menu defines */
  128.  
  129. #define Pop_up_prompt_vertical_size    3
  130. #define Pop_up_prompt_hor_adjust    3
  131. #define Pop_up_prompt_input_adjust    2
  132. #define List_separator            '|'
  133. #define List_delimiter            (char *) "|"
  134. #define Pop_up_menu_ver_extra        4
  135. #define Pop_up_menu_hor_extra        5
  136. #define Pop_up_menu_top            2
  137. #define Pop_up_menu_title_line        2